<template>
	<view class="all">
		<view class="navgator" :style="{'padding-top':statusHeight + 'px'}">
			<image mode="widthFix" src="../../static/f1.png" class="menu" @click="close"></image>
			<view class="center">
				<label class="title">矿工费设置</label>
		
			</view>
			
		</view>
		<view class="line"></view>
		
		<view class="currService">
			<view class="serviceItem">
				<label class="serviceName">矿工费</label>
				<view class="sericeFee">
					<label class="fee">{{currService.value}}ETH</label>
					<label class="rmb">￥ {{currService.rmb}}</label>
				</view>
			</view>
			
			<view class="Gas">Gas Price(47.0GWE)* Gas(60000) <image class="wenhao" src="../../static/img37.png" mode="widthFix"></image> </view>
		</view>
		
		<view class="GasPrice">
			<label> GasPrice</label>
			<label> 预计交易时间</label>
		</view>
		
		<view class="contentItem" v-for="(item,i) in GapsList">
			<view class="okImg">
					<image src="../../static/img36.png" mode="widthFix" class="okImg" v-if='gapIndex == i'></image>
			</view>
			
			<view :class="['item'+i,'item']" @click="chooseItem(i)">
				<view class="miaoshu">
					<label class="speedname">{{item.name}}</label>
					<label class="speed">{{item.speed}}</label>
				</view>
				<view class="time"><{{item.time}}分钟</view>
			</view>
		</view>
		
		<view class="okBtn" @click="okSev">确认</view>
	</view>
</template>

<script>
import Navgator from '../../componts/navgator.vue'
	export default {
		components: {
			Navgator
		},
		data() {
			return {
				serviceList:[],
				currService:{},
				rate:1,
				gapIndex:0,
				GapsList:[
					{
						name:"极速",
						speed:"47.0GWEI",
						time:'2.0'
					},
					{
						name:"快速",
						speed:"37.0GWEI",
						time:'5.0'
					},
					{
						name:"一般",
						speed:"32.5GWEI",
						time:'5.0'
					},
					{
						name:"缓慢",
						speed:"28.0GWEI",
						time:'30.0'
					}
				]
			}
		},
		onLoad(options) {
			console.log( JSON.parse(options.serviceList))
			this.serviceList =JSON.parse(options.serviceList)
			this.rate = options.rate
			this.setcurrService(this.gapIndex)
			
		},
		methods: {
			setcurrService(i){
				this.currService= this.serviceList[i];
				this.currService.rmb = this.currService.value * this.rate
			},
			chooseItem(i){
				this.gapIndex=i
				this.setcurrService(this.gapIndex)
				
			},
			close()
			{
				
				this.Api.back()
			},
			okSev(){
				uni.$emit('refeData',{index:this.gapIndex})
				this.Api.back()
			}
		},
		computed: {
			//状态栏高度
			statusHeight() {
				return uni.getSystemInfoSync().statusBarHeight +20 || 10; //如果没有获取到高度，那么指定10px；
			},
		
		
		}
	}
</script>

<style scoped>
	.all{
		background-color: #F7F7F7;
		height: 100vh;
	}
	.navgator {
		background-color: #F7F7F7;
		width: 100%;
		display: flex;
		box-sizing: border-box;
		align-items: center;
		height: 120rpx;
		padding: 40rpx 40rpx;
		border-bottom: 1rpx #F3F3F3 solid;
	
	}
	
	.menu {
		width: 40rpx;
	
	}
	
	.scan {
		width: 50rpx;
	
	
	}
	
	.center {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	
	.line{
		width: 100%;
		height: 1rpx;
		background-color: #979797;
	}
	.wenhao{
		width: 40rpx;
		margin-left: 20rpx;
	}
	.currService{
		width: 100%;
		margin-top: 20rpx;
		background-color: #FFF;
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
		padding: 20rpx;
	}
	.serviceItem{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		border-bottom: 1rpx  #979797 solid;
		padding: 40rpx 0;
		justify-content: space-between;
	}
	.serviceName{
		font-size: 35rpx;
		color:  #979797;
		
	}
	.sericeFee{
		display: flex;
		flex-direction: column;
		
	}
	.rmb{
		font-size: 20rpx;
		color:  #979797;
	}
	.Gas{
		display: flex;
		align-items: center;
		justify-content: flex-end;
		padding: 20rpx;
		color: #979797 ;
		font-size: 25rpx;
	}
	
	.GasPrice{
		width: 100%;
		padding: 30rpx 20rpx;
		box-sizing: border-box;
		display: flex;
		color: #9C9C9C;
		justify-content: space-between;
	}
	.contentItem{
		width: 100%;
		background-color: #FFF;
		padding: 20rpx;
		align-items: center;
		box-sizing: border-box;
		display: flex;
		flex-direction: row;
	}
	.okImg{
		width: 50rpx;
		
	}
	.item{
		flex: 1;
		margin-right: 20rpx;
		display: flex;
		justify-content: space-between;
		padding: 40rpx 0rpx;
		margin-left: 40rpx;
		align-items: center;
		border-bottom: 1rpx  #979797 solid;
	}
	.miaoshu{
		display: flex ;
		flex-direction: column;
	}
	.speed{
		color: #979797 ;
		font-size: 25rpx;
	}
	.time{
		color: #979797 ;
		font-size: 25rpx;
	}
	.item3{
		border-bottom: none;
	}
	
	.okBtn{
		width: 90%;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		color: white;
		position: fixed;
		bottom: 20rpx;
		left: 50%;
		transform: translateX(-50%);
		background-color: #0097FB;
		border-radius: 10rpx;
	}
</style>
